package com.ljx.itbbs.server.article.controller;

import com.ljx.itbbs.common.domain.vo.resp.ApiResult;
import com.ljx.itbbs.common.utils.ServletUtil;
import com.ljx.itbbs.server.article.domain.vo.resp.SignInfoResp;
import com.ljx.itbbs.server.article.service.SignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-03-27  09:47
 */
@Api(tags = "签到接口")
@RestController
@RequestMapping("/sign")
public class SignController {

    @Autowired
    private SignService signService;

    @ApiOperation("签到")
    @PostMapping("/in")
    public ApiResult<Void> signIn(){
        signService.signIn(ServletUtil.getUserId());

        return ApiResult.success();
    }

    @ApiOperation("查询签到信息")
    @GetMapping("/info")
    public ApiResult<SignInfoResp> signInfo(){

        return ApiResult.success(signService.getSignInfo(ServletUtil.getUserId()));
    }
}
